/* **********************************************************
 * Copyright 2010 Dimitar Vangelovski
 *
 * This file is part of the Gens3 3D Engine.
 * 
 * The Gens3 3D Engine is free software; you can redistribute it and/or
 * modify it under the terms of version 2 of the GNU General Public
 * License as published by the Free Software Foundation.
 * 
 * The Gens3 3D Engine is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with the Gens3 3D Engine; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301, USA
 * **********************************************************/


#pragma once

#include "common.h"
#include "3DMath.h"

class CScene;

class CCamera 
{
public:

	CCamera();
	~CCamera();

	void		SetPositionVector(float fPosX, float fPosY, float fPosZ) { m_vPosition = CVector(fPosX, fPosY, fPosZ); }
	void		SetViewVector(float fViewX, float fViewY, float fViewZ) { m_vView = CVector(fViewX, fViewY, fViewZ); }
	void		SetUpVector(float fUpVectorX, float fUpVectorY, float fUpVectorZ) { m_vUpVector = CVector(fUpVectorX, fUpVectorY, fUpVectorZ); }
	void		SetStrafeVector(float X, float Y, float Z) { m_vStrafe = CVector(X, Y, Z); }
	void		SetCameraRadius(float fRad) { m_fRadius = fRad; };

	CVector		GetPositionVector() const { return m_vPosition; }
	CVector		GetViewVector() const { return m_vView; }
	CVector		GetUpVector() const { return m_vUpVector; }
	CVector		GetStrafeVector() const	{ return m_vStrafe; }
	float		GetCameraRadius() const { return m_fRadius; }

	void		RotateView(float fAngle, float X, float Y, float Z);
	void		MouseLook(SDL_Surface * pSurface);
	void		RotateAroundPoint(CVector vCenter, float X, float Y, float Z);
	void		StrafeCamera(float fSpeed);
	void		MoveCamera(float fSpeed);
	void		CheckForMovement(Uint8 * pKeys, float fFrameInterval);
	void		CheckCameraCollision(CScene * pScene, float fFrameInterval);
	void		Update(SDL_Surface * pSurface, Uint8 * pKeys, float fFrameInterval);
	void		Look();

private:
	CVector		m_vPosition;
	CVector		m_vView;
	CVector		m_vUpVector;
	CVector		m_vStrafe;
	float		m_fRadius;		// The camera collision radius
};
